package cn.wgl.config;

import org.springframework.cloud.gateway.route.RouteLocator;
import org.springframework.cloud.gateway.route.builder.RouteLocatorBuilder;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class GatewayConfig {
    @Bean
    public RouteLocator consumerRouteLocator(RouteLocatorBuilder routeLocatorBuilder){
        RouteLocatorBuilder.Builder builder = routeLocatorBuilder.routes();
        builder.route("route_baiduxinwen_guonei", r -> r.path("/guonei").uri("http://news.baidu.com/guonei"));
        return builder.build();
    }

    @Bean
    public RouteLocator consumerRouteLoctor2(RouteLocatorBuilder routeLocatorBuilder){
        RouteLocatorBuilder.Builder builder = routeLocatorBuilder.routes();

        builder.route("route_baiduxinwen_guoji", r -> r.path("/guoji").uri("http://news.baidu.com/guoji"));

        return builder.build();
    }
}
